package com.admin.model.dto;

import com.admin.model.base.BaseDto;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.util.List;

/**
 * (Dept)实体类
 *
 * @author makejava
 * @since 2021-01-31 20:16:25
 */
@ApiModel("机构实体类")
@Data
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
public class DeptDto extends BaseDto implements Serializable {
    private static final long serialVersionUID = 759056931803829856L;
    /**
    * id
    */
    @ApiModelProperty("id")
    @NotNull(message = "id不能为空", groups = Update.class)
    @Null(message = "id必须为空", groups = Create.class)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    /**
    * 上级部门
    */
    @ApiModelProperty("上级岗位")
    @NotNull(message = "上级岗位不能为空", groups = Create.class)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long pid;
    /**
    * 部门名称
    */
    @ApiModelProperty("岗位名称")
    @NotBlank(message = "岗位名称不能为空", groups = Create.class)
    private String name;
    /**
    * 排序
    */
    @ApiModelProperty("排序")
    @NotNull(message = "排序不能为空", groups = Create.class)
    private Integer sort;
    /**
    * 状态
    */
    @ApiModelProperty("状态")
    private Boolean enabled;
    /**
     * 子部门
     */
    @ApiModelProperty("子部门")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private List<DeptDto> children;
}